import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:jm_flutter/src/config.dart';

import '../../common/common.dart';
import '../resources/resources.dart';
import '../routers/routes.dart';
import '../widget/widget.dart';

class AboutPage extends StatefulWidget {
  const AboutPage({Key? key}) : super(key: key);

  @override
  _AboutPageState createState() => _AboutPageState();
}

class _AboutPageState extends State<AboutPage> {
  @override
  Widget build(BuildContext context) {
    return MyScaffold(
      title: "关于",
      body: SafeArea(
        child: Padding(
          padding: const EdgeInsets.all(10.0),
          child: Column(
            children: [
              gapv(30),
              ClipRRect(
                borderRadius: BorderRadius.circular(6),
                child: MyImage(JmAssets.logoImage, width: 70),
              ),
              gapv(26),
              MyText(
                JmConfig.appName,
                weight: FontWeight.bold,
                size: 20,
                //color: Colors.grey[850],
              ),
              gapv(8),
              MyText(
                "V" + AppVersion.version,
                weight: FontWeight.normal,
                size: 15,
                color: Colors.grey[700],
              ),
              gapv(30),
              MyItem(
                title: "检查新版本",
                trailingText: AppVersion.isNew ? "发现新版本" : null,
                type: AppVersion.isNew ? MyItemType.empty : MyItemType.next,
                onTap: () {
                  //AppVersion.getNew();
                },
              ),
              MyItem(
                title: "用户协议",
                onTap: () {
                  // openUrl("https://www.jianshu.com/p/50e20d2b2285",
                  //     forceWebView: false);
                  Get.toNamed(JmPages.userAgreementPage);
                },
              ),
              MyItem(
                title: "隐私政策",
                onTap: () {
                  Get.toNamed(JmPages.privacyPolicyPage);
                },
              ),
              const Spacer(),
              MyText(
                "版权所有",
                size: 12,
                color: Colors.grey[400],
              ),
              gapv(10),
            ],
          ),
        ),
      ),
    );
  }
}
